//package com.example.daytest.batch;
//
//import org.apache.poi.hssf.record.formula.functions.T;
//import org.json.JSONObject;
//import org.springframework.util.CollectionUtils;
//
////import com.google.common.collect.Lists;
//
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.ArrayBlockingQueue;
//import java.util.concurrent.CountDownLatch;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.concurrent.TimeUnit;
//
///**
// * @author heyu
// * @title: SplitListUtils
// * @description:
// * @date 2022/6/15下午1:45
// */
//public class SplitListUtils {
//
////    /**
////     * 拆分集合
////     *
////     * @param <T> 泛型对象
////     * @param resList 需要拆分的集合
////     * @param subListLength 每个子集合的元素个数
////     * @return 返回拆分后的各个集合组成的列表
////     * 代码里面用到了guava和common的结合工具类
////     **/
////    public static <T> List<List<T>> split(List<T> resList, int subListLength) {
////        if (CollectionUtils.isEmpty(resList) || subListLength <= 0) {
////            return Lists.newArrayList();
////        }
////        List<List<T>> ret = Lists.newArrayList();
////        int size = resList.size();
////        if (size <= subListLength) {
////            // 数据量不足 subListLength 指定的大小
////            ret.add(resList);
////        } else {
////            int pre = size / subListLength;
////            int last = size % subListLength;
////            // 前面pre个集合，每个大小都是 subListLength 个元素
////            for (int i = 0; i < pre; i++) {
////                List<T> itemList = Lists.newArrayList();
////                for (int j = 0; j < subListLength; j++) {
////                    itemList.add(resList.get(i * subListLength + j));
////                }
////                ret.add(itemList);
////            }
////            // last的进行处理
////            if (last > 0) {
////                List<T> itemList = Lists.newArrayList();
////                for (int i = 0; i < last; i++) {
////                    itemList.add(resList.get(pre * subListLength + i));
////                }
////                ret.add(itemList);
////            }
////        }
////        return ret;
////    }
////
////    // 运行代码
////    public static void main(String[] args) {
////        List<String> list = Lists.newArrayList();
////        int size = 1099;
////        for (int i = 0; i < size; i++) {
////            list.add("hello-" + i);
////        }
////        // 大集合里面包含多个小集合
////        List<List<String>> temps = split(list, 100);
////        int j = 0;
////        // 对大集合里面的每一个小集合进行操作
////        for (List<String> obj : temps) {
////            System.out.println(String.format("row:%s -> size:%s,data:%s", ++j, obj.size(), obj));
////        }
////    }
////
////
////    public void threadMethod() {
////        List<T> updateList = new ArrayList();
////        // 初始化线程池, 参数一定要一定要一定要调好！！！！
////        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(20, 50,
////                4, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy());
////        // 大集合拆分成N个小集合, 这里集合的size可以稍微小一些（这里我用100刚刚好）, 以保证多线程异步执行, 过大容易回到单线程
////        List<T> splitNList = SplitListUtils.split(totalList, 100);
////        // 记录单个任务的执行次数
////        CountDownLatch countDownLatch = new CountDownLatch(splitNList.size());
////        // 对拆分的集合进行批量处理, 先拆分的集合, 再多线程执行
////        for (List<T> singleList : splitNList) {
////            // 线程池执行
////            threadPool.execute(new Thread(new Runnable(){
////                @Override
////                public void run() {
////                    for (Entity yangshiwen : singleList) {
////                        // 将每一个对象进行数据封装, 并添加到一个用于存储更新数据的list
////                        // ......
////
////                    }
////                }
////            }));
////            // 任务个数 - 1, 直至为0时唤醒await()
////            countDownLatch.countDown();
////        }
////        try {
////            // 让当前线程处于阻塞状态，直到锁存器计数为零
////            countDownLatch.await();
////        } catch (InterruptedException e) {
////            throw new BusinessLogException(ResponseEnum.FAIL);
////        }
////        // 通过mybatis的批量插入的方式来进行数据的插入, 这一步还是要做判空
////        if (GeneralUtil.listNotNull(updateList)) {
////            batchUpdateEntity(updateList);
////            LogUtil.info("xxxxxxxxxxxxxxx");
////        }
////    }
//
//    public static void main(String[] args) {
//        String str="{\n" +
//                "            \"bill_id\":\"18800208350\",\n" +
//                "            \"region_id\":\"212\",\n" +
//                "            \"cust_id\":\"21010026041916\",\n" +
//                "            \"cust_name\":\"开发*************\",\n" +
//                "            \"shopping_type\":\"\",\n" +
//                "            \"tache_code\":\"SHOP_CAR_SUBMIT\",\n" +
//                "            \"channel_type\":\"1\",\n" +
//                "            \"shopping_cart_data\":[\n" +
//                "                {\n" +
//                "                    \"bill_id\":\"18800208350\",\n" +
//                "                    \"business_id\":\"191000002023\",\n" +
//                "                    \"main_busi_id\":\"191000002023\",\n" +
//                "                    \"expOffer\":\"1\",\n" +
//                "                    \"product_spec_id\":\"390020024733\",\n" +
//                "                    \"product_spec_name\":\"完美融合包\",\n" +
//                "                    \"offer_alpha_name\":\"XWMRHBRHTC\",\n" +
//                "                    \"offer_name\":\"新完美融合包融合套餐\",\n" +
//                "                    \"use_eff_date\":\"2022-05-07 16:38:09\",\n" +
//                "                    \"use_exp_date\":\"2099-12-31 00:00:00\",\n" +
//                "                    \"effective_date\":\"2022-05-11 17:51:14\",\n" +
//                "                    \"expire_date\":\"2099-12-31 00:00:00\",\n" +
//                "                    \"offer_id\":\"390020024745\",\n" +
//                "                    \"offer_type\":\"OFFER_MIX\",\n" +
//                "                    \"brand\":\"0\",\n" +
//                "                    \"fee\":\"50\",\n" +
//                "                    \"mix_main_prod\":\"0\",\n" +
//                "                    \"mix_eff_type\":\"1\"\n" +
//                "                },\n" +
//                "                {\n" +
//                "                    \"offer_id\":\"390000216805\",\n" +
//                "                    \"offer_name\":\"魔百和组播\",\n" +
//                "                    \"expire_date\":\"2099-12-31 23:59:59\",\n" +
//                "                    \"effective_date\":\"2022-05-11 17:50:30\",\n" +
//                "                    \"offer_type\":\"OFFER_VAS\",\n" +
//                "                    \"relate_offer_id\":\"390000047613\",\n" +
//                "                    \"checkFlag\":0,\n" +
//                "                    \"prod_list\":[\n" +
//                "\n" +
//                "                    ],\n" +
//                "                    \"acct_id\":\"31027650350\",\n" +
//                "                    \"acct_name\":\"开发************\",\n" +
//                "                    \"cust_name\":\"开发*************\",\n" +
//                "                    \"bill_id\":\"18800208350\",\n" +
//                "                    \"oper_type\":\"\",\n" +
//                "                    \"eff_type\":\"1\",\n" +
//                "                    \"offer_state\":\"1\",\n" +
//                "                    \"op_bill_id\":\"18800208350\",\n" +
//                "                    \"product_spec_id\":\"171000000004\",\n" +
//                "                    \"main_busi_id\":\"191000001004\",\n" +
//                "                    \"ord_ext\":{\n" +
//                "                        \"tel\":\"\",\n" +
//                "                        \"booking_home_remarks\":\"\",\n" +
//                "                        \"agency_person\":\"\",\n" +
//                "                        \"certify_code\":\"\",\n" +
//                "                        \"certify_type_id\":\"\",\n" +
//                "                        \"remarks\":\"\",\n" +
//                "                        \"jk_charge_card\":0,\n" +
//                "                        \"booking_open_dt\":\"\",\n" +
//                "                        \"ext_done_type\":\"\",\n" +
//                "                        \"booking_home_desc\":\"8:00:00\",\n" +
//                "                        \"bill_id\":\"18800208350\",\n" +
//                "                        \"booking_home_dt\":\"2022-05-17\",\n" +
//                "                        \"CHN_Phone\":\"18800208350\"\n" +
//                "                    },\n" +
//                "                    \"ext_data\":{\n" +
//                "                        \"booking_home_dt\":\"2022-05-17 8:00:00\",\n" +
//                "                        \"addr_info\":{\n" +
//                "                            \"exchange_id\":\"20166\",\n" +
//                "                            \"district_id\":\"24\",\n" +
//                "                            \"standard_addr_id\":\"36818764\",\n" +
//                "                            \"district_name\":\"嘉定\",\n" +
//                "                            \"standard_addr_name\":\"上海市嘉定柳梁路118弄8号1层109室（新城悠活城三期）《商铺》\",\n" +
//                "                            \"community_name\":\"新城悠活城三期\",\n" +
//                "                            \"community_id\":\"978953\",\n" +
//                "                            \"access_type\":\"11\",\n" +
//                "                            \"busi_spec_id\":\"105000080167\",\n" +
//                "                            \"cust_name\":\"开发*************\",\n" +
//                "                            \"ext_attr_1\":\"null\",\n" +
//                "                            \"prod_spec_id\":\"105000080167\",\n" +
//                "                            \"is_jw_flag\":\"已交维\",\n" +
//                "                            \"ext_attr_2\":\"n***\",\n" +
//                "                            \"partner_id\":\"1\",\n" +
//                "                            \"ext_attr_3\":\"null\",\n" +
//                "                            \"std_flag\":\"1\",\n" +
//                "                            \"ge_wband_flag\":\"S\",\n" +
//                "                            \"is_merging\":\"Y\",\n" +
//                "                            \"cluster_village\":\"否\",\n" +
//                "                            \"standard_addr_spell\":\"118弄8号1层109室（新城悠活城三期）《商铺》\",\n" +
//                "                            \"detail_addr\":\"上海市嘉定柳梁路118弄8号1层109室（新城悠活城三期）《商铺》1楼号1楼层101室\",\n" +
//                "                            \"floor_mesg\":\"1楼号1楼层\",\n" +
//                "                            \"room_mesg\":\"101室\"\n" +
//                "                        }\n" +
//                "                    },\n" +
//                "                    \"price_plan\":[\n" +
//                "\n" +
//                "                    ],\n" +
//                "                    \"business_id\":\"191000000004\",\n" +
//                "                    \"business_name\":\"订购增值策划\",\n" +
//                "                    \"selected\":\"1\",\n" +
//                "                    \"spec_id\":\"171000000004\",\n" +
//                "                    \"expOffer\":\"1\"\n" +
//                "                }\n" +
//                "            ],\n" +
//                "            \"ChannelDesc\":\"FUSEAPP\"\n" +
//                "        }";
//        JSONObject
//    }
//
//}
